﻿using MediatR;
using RBAC.Domain;
using RBAC.Domain.Service.Interfae;
using RBACDuYaJun.Api.Appliction.Command.LeaveCommand;

namespace RBACDuYaJun.Api.Appliction.CommandHandlers.LeaveHanders
{
    public class LeaveShowCommandHandler : IRequestHandler<LeaveShowCommand, PageDto<Leave>>
    {
        private readonly ILeaveService _leaveService;
        public LeaveShowCommandHandler(ILeaveService leaveService)
        {
            _leaveService = leaveService;
        }

        public async Task<PageDto<Leave>> Handle(LeaveShowCommand request, CancellationToken cancellationToken)
        {
            return await _leaveService.GetLeavesList(request.names, request.pageSize, request.pageIndex, request.Sdate, request.Edate, request.Lnames);
        }
    }
}
